//------------------------------------------------------------------------------
// X2D Game Engine
// Copyright (C) 2006-2007 Janusz Kowalski
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------

#include "SDL.h"
#include "imgSDL.h"

#include "x2tk_Graphics.h"

#ifndef FONTSDL_H
#define FONTSDL_H

#define FONT_EFFECT_NONE    0
#define FONT_EFFECT_WAVES   1

class Font {
  private:
    Image *fontImg_;
    int effect;
    void draw(GraphicContext &g, int x, int y, unsigned char c);
    int chW_, chH_;
  public:
    // Create empty font.
    Font();
    
    // Create font using given file.
    // See: load(...)
    Font(const char *path);
    ~Font();
    
    Font &operator=(const Font &right);
    
    Font(const Font &src);
    
    // Read font from file.
    // If the file cannot be read, the font becomes empty.
    void load(const char *path);
    
    void drawText(GraphicContext &g, int x, int y, const char *text);
    
    void drawText(SDL_Surface *dest_surf, int x, int y, const char *text);
    
    void drawText(GraphicContext &g, int x, int y, const char *text, int n);

    // Draw centered text.
    void drawText(SDL_Surface *dest_surf, int y, const char *text);
    
    void draw_text_centered(SDL_Surface *dest_surf, const char *text);
    
    // Width of the text.
    int w(const char *text);
    
    // Height of the text.
    int h(const char *text);
    
    int getW(const char *text);
    int getH(const char *text);
    
    int getCharW() {return chW_;}
    int getCharH() {return chH_;}
};

#endif
